Update to rust master
authorAlex Crichton <alex@alexcrichton.com>
Mon, 16 Mar 2015 13:27:58 +0000 (06:27 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 17 Mar 2015 16:26:13 +0000 (09:26 -0700)
28 files changed:
Cargo.lock
Cargo.toml
src/bin/cargo.rs
src/bin/verify_project.rs
src/cargo/core/shell.rs
src/cargo/core/source.rs
src/cargo/lib.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_new.rs
src/cargo/sources/git/utils.rs
src/cargo/sources/path.rs
src/cargo/sources/registry.rs
src/cargo/util/errors.rs
src/cargo/util/mod.rs
src/cargo/util/paths.rs
src/cargo/util/sha256.rs
src/cargo/util/toml.rs
src/registry/lib.rs
src/rustversion.txt
tests/test_cargo_build_auth.rs
tests/test_cargo_build_lib.rs
tests/test_cargo_compile.rs
tests/test_cargo_compile_git_deps.rs
tests/test_cargo_compile_path_deps.rs
tests/test_cargo_profiles.rs
tests/test_cargo_run.rs
tests/test_shell.rs
tests/tests.rs

index fc044abefcdc5e1f8a8a760a0d502690d40c2ecd..1a92674f03acf21babee0e4d3007e1abfc3234df 100644 (file)
@@ -4,26 +4,27 @@ version = "0.1.0"
 dependencies = [
  "advapi32-sys 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "docopt 0.6.47 (registry+https://github.com/rust-lang/crates.io-index)",
+ "docopt 0.6.51 (registry+https://github.com/rust-lang/crates.io-index)",
  "env_logger 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "flate2 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "git2-curl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glob 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "hamcrest 0.1.0 (git+https://github.com/carllerche/hamcrest-rust.git)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
  "registry 0.1.0",
- "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "semver 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "tar 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tar 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempdir 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -46,9 +47,9 @@ version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "curl-sys 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -56,7 +57,7 @@ name = "curl-sys"
 version = "0.1.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -64,12 +65,12 @@ dependencies = [
 
 [[package]]
 name = "docopt"
-version = "0.6.47"
+version = "0.6.51"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -78,7 +79,7 @@ version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "regex 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "regex 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -86,7 +87,7 @@ name = "flate2"
 version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "miniz-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -97,13 +98,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "git2"
-version = "0.2.1"
+version = "0.2.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -112,20 +113,20 @@ version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "url 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
+ "url 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "glob"
-version = "0.2.3"
+version = "0.2.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "hamcrest"
 version = "0.1.0"
-source = "git+https://github.com/carllerche/hamcrest-rust.git#c90897390602ef1ad29de8988cc8b0ed23b540cd"
+source = "git+https://github.com/carllerche/hamcrest-rust.git#27a3368a915aabdee09c9f2c515127689715c1d9"
 
 [[package]]
 name = "kernel32-sys"
@@ -137,16 +138,16 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.1.2"
+version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "libgit2-sys"
-version = "0.2.2"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "libssh2-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libssh2-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -162,10 +163,10 @@ dependencies = [
 
 [[package]]
 name = "libssh2-sys"
-version = "0.1.11"
+version = "0.1.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libz-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "openssl-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -195,7 +196,7 @@ version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -204,7 +205,7 @@ version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "libressl-pnacl-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "pkg-config 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -224,13 +225,13 @@ name = "rand"
 version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "regex"
-version = "0.1.19"
+version = "0.1.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -238,12 +239,12 @@ name = "registry"
 version = "0.1.0"
 dependencies = [
  "curl 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "rustc-serialize"
-version = "0.3.1"
+version = "0.3.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -253,7 +254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "tar"
-version = "0.2.3"
+version = "0.2.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -266,11 +267,10 @@ dependencies = [
 
 [[package]]
 name = "term"
-version = "0.1.13"
+version = "0.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "kernel32-sys 0.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -281,11 +281,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "time"
-version = "0.1.19"
+version = "0.1.20"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "gcc 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -293,16 +293,16 @@ name = "toml"
 version = "0.1.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "url"
-version = "0.2.23"
+version = "0.2.27"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -310,6 +310,6 @@ name = "winapi"
 version = "0.1.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
index 8e9ae24f8a19dd4243468794b03f2b2ddb8a16a7..f88b90f9e61da83bc8ee3f62937d0478a9903b78 100644 (file)
@@ -24,16 +24,16 @@ env_logger = "0.2.2"
 docopt = "0.6.45"
 url = "0.2.23"
 rustc-serialize = "0.3.1"
-term = "0.1.13"
+term = "0.2"
 regex = "0.1.18"
 threadpool = "0.1.1"
 libc = "0.1.2"
 registry = { path = "src/registry" }
 
 [target.i686-pc-windows-gnu]
-dependencies = { winapi = "0.1", advapi32-sys = "*" }
+dependencies = { winapi = "0.1", advapi32-sys = "*", kernel32-sys = "*" }
 [target.x86_64-pc-windows-gnu]
-dependencies = { winapi = "0.1", advapi32-sys = "*" }
+dependencies = { winapi = "0.1", advapi32-sys = "*", kernel32-sys = "*" }
 
 [dev-dependencies]
 tempdir = "0.3"
index e87288d1d254da8d72c8bc9c36205a223822261e..0ad3a53c2d86e58a06434411c04605e14b36ed0b 100644 (file)
@@ -1,4 +1,4 @@
-#![feature(core, io, path, std_misc, exit_status)]
+#![feature(core, io, std_misc, exit_status)]
 
 extern crate "git2-curl" as git2_curl;
 extern crate "rustc-serialize" as rustc_serialize;
index 43056c13d2589308b86811c790bf4f318af854c5..dcef2c4798ddef4615932ecfd60a3207c4908446 100644 (file)
@@ -31,7 +31,7 @@ pub fn execute(args: Flags, config: &Config) -> CliResult<Option<Error>> {
     let mut contents = String::new();
     let file = File::open(&args.flag_manifest_path);
     match file.and_then(|mut f| f.read_to_string(&mut contents)) {
-        Ok(()) => {},
+        Ok(_) => {},
         Err(e) => return fail("invalid", &format!("error reading file: {}", e))
     };
     match toml::Parser::new(&contents).parse() {
index 775e73e77839be1bc9e516a1c144196ccfa308a2..ad28ae63ddb36858f0adbb70ee5c7f06b2147d97 100644 (file)
@@ -1,5 +1,6 @@
 use std::fmt;
-use std::old_io::{IoResult, stderr};
+use std::io::prelude::*;
+use std::io;
 
 use term::Attr;
 use term::color::{Color, BLACK, RED, GREEN, YELLOW};
@@ -15,7 +16,7 @@ pub struct ShellConfig {
 }
 
 enum AdequateTerminal {
-    NoColor(Box<Writer + Send>),
+    NoColor(Box<Write + Send>),
     Colored(Box<Terminal<UghWhyIsThisNecessary> + Send>)
 }
 
@@ -31,7 +32,7 @@ pub struct MultiShell {
 }
 
 struct UghWhyIsThisNecessary {
-    inner: Box<Writer + Send>,
+    inner: Box<Write + Send>,
 }
 
 impl MultiShell {
@@ -47,35 +48,35 @@ impl MultiShell {
         &mut self.err
     }
 
-    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> IoResult<()> {
+    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> io::Result<()> {
         self.out().say(message, color)
     }
 
-    pub fn status<T, U>(&mut self, status: T, message: U) -> IoResult<()>
+    pub fn status<T, U>(&mut self, status: T, message: U) -> io::Result<()>
         where T: fmt::Display, U: fmt::Display
     {
         self.out().say_status(status, message, GREEN)
     }
 
-    pub fn verbose<F>(&mut self, mut callback: F) -> IoResult<()>
-        where F: FnMut(&mut MultiShell) -> IoResult<()>
+    pub fn verbose<F>(&mut self, mut callback: F) -> io::Result<()>
+        where F: FnMut(&mut MultiShell) -> io::Result<()>
     {
         if self.verbose { return callback(self) }
         Ok(())
     }
 
-    pub fn concise<F>(&mut self, mut callback: F) -> IoResult<()>
-        where F: FnMut(&mut MultiShell) -> IoResult<()>
+    pub fn concise<F>(&mut self, mut callback: F) -> io::Result<()>
+        where F: FnMut(&mut MultiShell) -> io::Result<()>
     {
         if !self.verbose { return callback(self) }
         Ok(())
     }
 
-    pub fn error<T: ToString>(&mut self, message: T) -> IoResult<()> {
+    pub fn error<T: ToString>(&mut self, message: T) -> io::Result<()> {
         self.err().say(message, RED)
     }
 
-    pub fn warn<T: ToString>(&mut self, message: T) -> IoResult<()> {
+    pub fn warn<T: ToString>(&mut self, message: T) -> io::Result<()> {
         self.err().say(message, YELLOW)
     }
 
@@ -89,7 +90,7 @@ impl MultiShell {
 }
 
 impl Shell {
-    pub fn create(out: Box<Writer + Send>, config: ShellConfig) -> Shell {
+    pub fn create(out: Box<Write + Send>, config: ShellConfig) -> Shell {
         let out = UghWhyIsThisNecessary { inner: out };
         if config.tty && config.color {
             let term = TerminfoTerminal::new(out);
@@ -97,58 +98,58 @@ impl Shell {
                 terminal: Colored(Box::new(t)),
                 config: config
             }).unwrap_or_else(|| {
-                Shell { terminal: NoColor(Box::new(stderr())), config: config }
+                Shell { terminal: NoColor(Box::new(io::stderr())), config: config }
             })
         } else {
             Shell { terminal: NoColor(out.inner), config: config }
         }
     }
 
-    pub fn verbose<F>(&mut self, mut callback: F) -> IoResult<()>
-        where F: FnMut(&mut Shell) -> IoResult<()>
+    pub fn verbose<F>(&mut self, mut callback: F) -> io::Result<()>
+        where F: FnMut(&mut Shell) -> io::Result<()>
     {
         if self.config.verbose { return callback(self) }
         Ok(())
     }
 
-    pub fn concise<F>(&mut self, mut callback: F) -> IoResult<()>
-        where F: FnMut(&mut Shell) -> IoResult<()>
+    pub fn concise<F>(&mut self, mut callback: F) -> io::Result<()>
+        where F: FnMut(&mut Shell) -> io::Result<()>
     {
         if !self.config.verbose { return callback(self) }
         Ok(())
     }
 
-    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> IoResult<()> {
+    pub fn say<T: ToString>(&mut self, message: T, color: Color) -> io::Result<()> {
         try!(self.reset());
         if color != BLACK { try!(self.fg(color)); }
-        try!(self.write_line(&message.to_string()));
+        try!(write!(self, "{}\n", message.to_string()));
         try!(self.reset());
         try!(self.flush());
         Ok(())
     }
 
     pub fn say_status<T, U>(&mut self, status: T, message: U, color: Color)
-                            -> IoResult<()>
+                            -> io::Result<()>
         where T: fmt::Display, U: fmt::Display
     {
         try!(self.reset());
         if color != BLACK { try!(self.fg(color)); }
         if self.supports_attr(Attr::Bold) { try!(self.attr(Attr::Bold)); }
-        try!(self.write_str(&format!("{:>12}", status)));
+        try!(write!(self, "{:>12}", status.to_string()));
         try!(self.reset());
-        try!(self.write_line(&format!(" {}", message)));
+        try!(write!(self, " {}\n", message));
         try!(self.flush());
         Ok(())
     }
 
-    fn fg(&mut self, color: color::Color) -> IoResult<bool> {
+    fn fg(&mut self, color: color::Color) -> io::Result<bool> {
         match self.terminal {
             Colored(ref mut c) => c.fg(color),
             NoColor(_) => Ok(false)
         }
     }
 
-    fn attr(&mut self, attr: Attr) -> IoResult<bool> {
+    fn attr(&mut self, attr: Attr) -> io::Result<bool> {
         match self.terminal {
             Colored(ref mut c) => c.attr(attr),
             NoColor(_) => Ok(false)
@@ -162,7 +163,7 @@ impl Shell {
         }
     }
 
-    fn reset(&mut self) -> IoResult<()> {
+    fn reset(&mut self) -> io::Result<()> {
         match self.terminal {
             Colored(ref mut c) => c.reset().map(|_| ()),
             NoColor(_) => Ok(())
@@ -170,15 +171,15 @@ impl Shell {
     }
 }
 
-impl Writer for Shell {
-    fn write_all(&mut self, buf: &[u8]) -> IoResult<()> {
+impl Write for Shell {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
         match self.terminal {
-            Colored(ref mut c) => c.write_all(buf),
-            NoColor(ref mut n) => n.write_all(buf)
+            Colored(ref mut c) => c.write(buf),
+            NoColor(ref mut n) => n.write(buf)
         }
     }
 
-    fn flush(&mut self) -> IoResult<()> {
+    fn flush(&mut self) -> io::Result<()> {
         match self.terminal {
             Colored(ref mut c) => c.flush(),
             NoColor(ref mut n) => n.flush()
@@ -186,8 +187,11 @@ impl Writer for Shell {
     }
 }
 
-impl Writer for UghWhyIsThisNecessary {
-    fn write_all(&mut self, bytes: &[u8]) -> IoResult<()> {
-        self.inner.write_all(bytes)
+impl Write for UghWhyIsThisNecessary {
+    fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
+        self.inner.write(bytes)
+    }
+    fn flush(&mut self) -> io::Result<()> {
+        self.inner.flush()
     }
 }
index 9eb6bbd931dccf4fce69883f7ca7802ff27dd22b..fe9e33171ed4c7848c4a6f57a3337ca24d27f4f9 100644 (file)
@@ -3,7 +3,7 @@ use std::collections::hash_map::{HashMap, Values, IterMut};
 use std::fmt::{self, Formatter};
 use std::hash;
 use std::mem;
-use std::path::{Path, PathBuf};
+use std::path::Path;
 use std::sync::Arc;
 use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
 
@@ -198,7 +198,7 @@ impl SourceId {
         match self.inner.kind {
             Kind::Git(..) => Box::new(GitSource::new(self, config)) as Box<Source>,
             Kind::Path => {
-                let path = match self.inner.url.to_file_path::<PathBuf>() {
+                let path = match self.inner.url.to_file_path() {
                     Ok(p) => p,
                     Err(()) => panic!("path sources cannot be remote"),
                 };
index 348cec6d0989d5f17ce036d3b5d1fafb0a639762..cf35f1f49ddc7e06d47a537a6837d884e1672b3b 100644 (file)
@@ -1,6 +1,6 @@
 #![deny(unused)]
-#![feature(hash, os, std_misc, core)]
-#![feature(io, path, str_words, old_io, exit_status, fs_time)]
+#![feature(hash, os, std_misc, core, path_relative_from)]
+#![feature(io, str_words, exit_status, fs_time)]
 #![cfg_attr(test, deny(warnings))]
 
 #[cfg(test)] extern crate hamcrest;
@@ -25,8 +25,8 @@ extern crate registry;
 
 use std::env;
 use std::error::Error;
-use std::old_io::stdio::{stdout_raw, stderr_raw};
-use std::old_io::{self, stdout, stderr};
+use std::io::prelude::*;
+use std::io;
 use rustc_serialize::{Decodable, Encodable};
 use rustc_serialize::json::{self, Json};
 use docopt::Docopt;
@@ -119,21 +119,39 @@ pub fn process_executed<T>(result: CliResult<Option<T>>, shell: &mut MultiShell)
 }
 
 pub fn shell(verbose: bool) -> MultiShell {
-    let tty = stderr_raw().isatty();
-    let stderr = Box::new(stderr()) as Box<Writer + Send>;
+    let tty = isatty(libc::STDERR_FILENO);
+    let stderr = Box::new(io::stderr());
 
     let config = ShellConfig { color: true, verbose: verbose, tty: tty };
     let err = Shell::create(stderr, config);
 
-    let tty = stdout_raw().isatty();
-    let stdout = Box::new(stdout()) as Box<Writer + Send>;
+    let tty = isatty(libc::STDOUT_FILENO);
+    let stdout = Box::new(io::stdout());
 
     let config = ShellConfig { color: true, verbose: verbose, tty: tty };
     let out = Shell::create(stdout, config);
 
-    MultiShell::new(out, err, verbose)
-}
+    return MultiShell::new(out, err, verbose);
 
+    #[cfg(unix)]
+    fn isatty(fd: libc::c_int) -> bool {
+        unsafe { libc::isatty(fd) != 0 }
+    }
+    #[cfg(windows)]
+    fn isatty(fd: libc::c_int) -> bool {
+        extern crate "kernel32-sys" as kernel32;
+        extern crate winapi;
+        unsafe {
+            let handle = kernel32::GetStdHandle(if fd == libc::STDOUT_FILENO {
+                winapi::winbase::STD_OUTPUT_HANDLE
+            } else {
+                winapi::winbase::STD_ERROR_HANDLE
+            });
+            let mut out = 0;
+            kernel32::GetConsoleMode(handle, &mut out) != 0
+        }
+    }
+}
 
 // `output` print variant error strings to either stderr or stdout.
 // For fatal errors, print to stderr;
@@ -216,8 +234,9 @@ fn flags_from_args<'a, T>(usage: &str, args: &[String],
 }
 
 fn json_from_stdin<T: Decodable>() -> CliResult<T> {
-    let mut reader = old_io::stdin();
-    let input = try!(reader.read_to_string().map_err(|_| {
+    let mut reader = io::stdin();
+    let mut input = String::new();
+    try!(reader.read_to_string(&mut input).map_err(|_| {
         CliError::new("Standard in did not exist or was not UTF-8", 1)
     }));
 
index f9fd404a09e591608bd0873c593eb5a689f8f20c..63de500f16c4c8ab1cab1627226e9e62e0b58efb 100644 (file)
@@ -25,7 +25,6 @@
 use std::collections::HashMap;
 use std::default::Default;
 use std::num::ToPrimitive;
-use std::os;
 use std::path::{Path, PathBuf};
 use std::sync::Arc;
 
@@ -205,7 +204,9 @@ fn scrape_build_config(config: &Config,
         }
         None => None,
     };
-    let jobs = jobs.or(cfg_jobs).unwrap_or(os::num_cpus() as u32);
+    #[allow(deprecated)]
+    fn num_cpus() -> u32 { ::std::os::num_cpus() as u32 }
+    let jobs = jobs.or(cfg_jobs).unwrap_or(num_cpus());
     let mut base = ops::BuildConfig {
         jobs: jobs,
         requested_target: target.clone(),
index efb7d99e49a44700bac87ea22fb53ae716311903..1194d1159e388fdabe38a369b4d2cff5ed2a0ae0 100644 (file)
@@ -141,7 +141,7 @@ fn it_works() {
 fn discover_author() -> CargoResult<(String, Option<String>)> {
     let git_config = GitConfig::open_default().ok();
     let git_config = git_config.as_ref();
-    let name = git_config.and_then(|g| g.get_str("user.name").ok())
+    let name = git_config.and_then(|g| g.get_string("user.name").ok())
                          .map(|s| s.to_string())
                          .or_else(|| env::var("USER").ok())      // unix
                          .or_else(|| env::var("USERNAME").ok()); // windows
@@ -153,7 +153,7 @@ fn discover_author() -> CargoResult<(String, Option<String>)> {
                                       user, please set ${}", username_var)))
         }
     };
-    let email = git_config.and_then(|g| g.get_str("user.email").ok());
+    let email = git_config.and_then(|g| g.get_string("user.email").ok());
 
     let name = name.trim().to_string();
     let email = email.map(|s| s.trim().to_string());
index a49d500de8137e85a7d8767458ab00e22a8b84bb..b1b463750eee22196360eec9059051aa94076d48 100644 (file)
@@ -1,7 +1,6 @@
 use std::fmt;
 use std::path::{Path, PathBuf};
 use std::fs;
-use std::io::prelude::*;
 
 use rustc_serialize::{Encodable, Encoder};
 use url::Url;
@@ -286,7 +285,7 @@ impl<'a> GitCheckout<'a> {
     fn reset(&self) -> CargoResult<()> {
         info!("reset {} to {}", self.repo.path().display(), self.revision);
         let object = try!(self.repo.find_object(self.revision.0, None));
-        try!(self.repo.reset(&object, git2::ResetType::Hard, None, None, None));
+        try!(self.repo.reset(&object, git2::ResetType::Hard, None));
         Ok(())
     }
 
@@ -338,7 +337,7 @@ impl<'a> GitCheckout<'a> {
                 }));
 
                 let obj = try!(repo.find_object(head, None));
-                try!(repo.reset(&obj, git2::ResetType::Hard, None, None, None));
+                try!(repo.reset(&obj, git2::ResetType::Hard, None));
                 try!(update_submodules(&repo));
             }
             Ok(())
@@ -371,11 +370,16 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
     cred_helper.config(cfg);
     let mut cred_error = false;
     let ret = f(&mut |url, username, allowed| {
-        let creds = if allowed.contains(git2::SSH_KEY) {
+        let creds = if allowed.contains(git2::SSH_KEY) ||
+                       allowed.contains(git2::USERNAME) {
             let user = username.map(|s| s.to_string())
                                .or_else(|| cred_helper.username.clone())
                                .unwrap_or("git".to_string());
-            git2::Cred::ssh_key_from_agent(&user)
+            if allowed.contains(git2::USERNAME) {
+                git2::Cred::username(&user)
+            } else {
+                git2::Cred::ssh_key_from_agent(&user)
+            }
         } else if allowed.contains(git2::USER_PASS_PLAINTEXT) {
             git2::Cred::credential_helper(cfg, url, username)
         } else if allowed.contains(git2::DEFAULT) {
@@ -405,7 +409,7 @@ pub fn fetch(repo: &git2::Repository, url: &str,
         let mut remote = try!(repo.remote_anonymous(&url, Some(refspec)));
         try!(remote.add_fetch("refs/tags/*:refs/tags/*"));
         remote.set_callbacks(&mut cb);
-        try!(remote.fetch(&["refs/tags/*:refs/tags/*", refspec], None, None));
+        try!(remote.fetch(&["refs/tags/*:refs/tags/*", refspec], None));
         Ok(())
     })
 }
index 6e56f9941a841fb4c5d7c7b63e71d9b2f6f1c703..49c7504162d99c8bd2159d3f38b18862038acc0c 100644 (file)
@@ -9,7 +9,7 @@ use git2;
 
 use core::{Package, PackageId, Summary, SourceId, Source, Dependency, Registry};
 use ops;
-use util::{self, CargoResult, internal, internal_error, human, ChainError, Config};
+use util::{CargoResult, internal, internal_error, human, ChainError, Config};
 
 pub struct PathSource<'a, 'b: 'a> {
     id: SourceId,
@@ -138,10 +138,6 @@ impl<'a, 'b> PathSource<'a, 'b> {
             None => return Err(internal_error("Can't list files on a bare repository.", "")),
         };
 
-        // Right now there is a bug such that "/a/b".relative_from("/a/")
-        // returns `None` so here we chop of the trailing slash if there is one.
-        // It is unclear to me whether this is actually a bug with paths or not.
-        let root = util::lose_the_slash(&root);
         let pkg_path = pkg.root();
 
         let mut ret = Vec::new();
index 3159aa9c037c4e203fdcab0016b8eeb58a57fd67..cf5db84eaed473478ff95213ee82f0881004e7fb 100644 (file)
@@ -456,7 +456,7 @@ impl<'a, 'b> RegistrySource<'a, 'b> {
         let oid = try!(repo.refname_to_id(reference));
         trace!("[{}] updating to rev {}", self.source_id, oid);
         let object = try!(repo.find_object(oid, None));
-        try!(repo.reset(&object, git2::ResetType::Hard, None, None, None));
+        try!(repo.reset(&object, git2::ResetType::Hard, None));
         self.updated = true;
         self.cache.clear();
         Ok(())
index 45ccc20dfcadec08bae7550c76975cd9134a52c6..a58bfb7b7f221a098300c24d4b64ba7a1233a99f 100644 (file)
@@ -2,7 +2,6 @@ use std::error::{FromError, Error};
 use std::ffi;
 use std::fmt;
 use std::io;
-use std::old_io::IoError;
 use std::process::{Output, ExitStatus};
 use std::str;
 
@@ -255,7 +254,6 @@ macro_rules! from_error {
 
 from_error! {
     semver::ReqParseError,
-    IoError,
     io::Error,
     ProcessError,
     git2::Error,
@@ -273,7 +271,6 @@ impl<E: CargoError> FromError<Human<E>> for Box<CargoError> {
 }
 
 impl CargoError for semver::ReqParseError {}
-impl CargoError for IoError {}
 impl CargoError for io::Error {}
 impl CargoError for git2::Error {}
 impl CargoError for json::DecoderError {}
index 14f16393fb7a801e9acdd53559ddcc82e6e2b07a..6334b0ddbea39af8ef59de0d330793b9388770c9 100644 (file)
@@ -5,7 +5,7 @@ pub use self::errors::{CliError, ProcessError};
 pub use self::errors::{process_error, internal_error, internal, human};
 pub use self::errors::{Human, caused_human};
 pub use self::paths::{join_paths, path2bytes, bytes2path, dylib_path};
-pub use self::paths::{normalize_path, lose_the_slash};
+pub use self::paths::normalize_path;
 pub use self::lev_distance::{lev_distance};
 pub use self::hex::{to_hex, short_hash};
 pub use self::dependency_queue::{DependencyQueue, Fresh, Dirty, Freshness};
index 9f736f381c8199876d5bf5061849c35d57b03312..a13d534c57bf6b022a52203d7ef867ff6fb0f2df 100644 (file)
@@ -26,8 +26,9 @@ pub fn dylib_path() -> Vec<PathBuf> {
 }
 
 pub fn normalize_path(path: &Path) -> PathBuf {
-    let mut components = path.components();
-    let mut ret = if let Some(c @ Component::Prefix { .. }) = components.peek() {
+    let mut components = path.components().peekable();
+    let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek()
+                                                                     .cloned() {
         components.next();
         PathBuf::new(c.as_os_str())
     } else {
@@ -36,8 +37,7 @@ pub fn normalize_path(path: &Path) -> PathBuf {
 
     for component in components {
         match component {
-            Component::Prefix { .. } => unreachable!(),
-            Component::Empty => { ret.push(""); }
+            Component::Prefix(..) => unreachable!(),
             Component::RootDir => { ret.push(component.as_os_str()); }
             Component::CurDir => {}
             Component::ParentDir => { ret.pop(); }
@@ -47,15 +47,6 @@ pub fn normalize_path(path: &Path) -> PathBuf {
     return ret;
 }
 
-/// Chop off the trailing slash of a path
-pub fn lose_the_slash(path: &Path) -> &Path {
-    let mut components = path.components();
-    match components.next_back() {
-        Some(Component::CurDir) => components.as_path(),
-        _ => path,
-    }
-}
-
 #[cfg(unix)]
 pub fn path2bytes(path: &Path) -> CargoResult<&[u8]> {
     use std::os::unix::prelude::*;
index 40d7518bfba73e1f4a19ce85f8f85479b7f459b0..f008187733d4b794f4bddfd8a3106d1ee8f0da94 100644 (file)
@@ -72,7 +72,7 @@ mod imp {
 mod imp {
     extern crate winapi;
     extern crate "advapi32-sys" as advapi32;
-    use std::os;
+    use std::io;
     use std::ptr;
 
     use self::winapi::{DWORD, HCRYPTPROV, HCRYPTHASH};
@@ -82,7 +82,7 @@ mod imp {
 
     macro_rules! call{ ($e:expr) => ({
         if $e == 0 {
-            panic!("failed {}: {}", stringify!($e), os::last_os_error())
+            panic!("failed {}: {}", stringify!($e), io::Error::last_os_error())
         }
     }) }
 
index 35e130418be88deb2cc214b209ebc2f9b789f617..603adcb65d16487945b03d556b063bc3c01d2530 100644 (file)
@@ -2,7 +2,6 @@ use std::collections::HashMap;
 use std::default::Default;
 use std::fmt;
 use std::fs;
-use std::io::prelude::*;
 use std::path::{Path, PathBuf};
 use std::slice;
 use std::str;
index 93b94b66cd361c3bdc2721b017c9d561aee74d63..5bb06b25ba5718819059f91e2242965083673159 100644 (file)
@@ -1,5 +1,3 @@
-#![feature(io, path)]
-
 extern crate curl;
 extern crate "rustc-serialize" as rustc_serialize;
 
index d9ca78f0ecd63423bdb1d50016b26a30cbc89d4d..cadd5e2ca06a04d0df3074516a21017d69d497b0 100644 (file)
@@ -1 +1 @@
-2015-03-11
+2015-03-14
index eaa495f3e5ff0f2e59978f77b03e61097f63db14..da306c1a5f71f9792123765e46ee73ee6efab7eb 100644 (file)
@@ -39,7 +39,7 @@ test!(http_auth_offered {
         assert_eq!(req, vec![
             "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
             "Accept: */*",
-            "User-Agent: git/1.0 (libgit2 0.21.0)",
+            "User-Agent: git/1.0 (libgit2 0.22.0)",
         ].into_iter().map(|s| s.to_string()).collect());
         drop(s);
 
@@ -54,7 +54,7 @@ test!(http_auth_offered {
             "GET /foo/bar/info/refs?service=git-upload-pack HTTP/1.1",
             "Authorization: Basic Zm9vOmJhcg==",
             "Accept: */*",
-            "User-Agent: git/1.0 (libgit2 0.21.0)",
+            "User-Agent: git/1.0 (libgit2 0.22.0)",
         ].into_iter().map(|s| s.to_string()).collect());
     });
 
index ec20d6e53f26c70494b8df439204dedd89b243fc..97320184a0fb2e50a22e8a62b8cf1f95ce248083 100644 (file)
@@ -1,4 +1,4 @@
-use std::old_path;
+use std::path::MAIN_SEPARATOR as SEP;
 use support::{basic_bin_manifest, execs, project, ProjectBuilder};
 use support::{COMPILING, RUNNING};
 use hamcrest::{assert_that};
@@ -17,7 +17,7 @@ fn verbose_output_for_lib(p: &ProjectBuilder) -> String {
         -L dependency={dir}{sep}target{sep}debug \
         -L dependency={dir}{sep}target{sep}debug{sep}deps`
 ",
-            running = RUNNING, compiling = COMPILING, sep = old_path::SEP,
+            running = RUNNING, compiling = COMPILING, sep = SEP,
             dir = p.root().display(), url = p.url(),
             name = "foo", version = "0.0.1")
 }
index 253f81812b868fc7e42a7118304e114ce46b2d68..b3fc84c1a16d90f54c6e30f28af89f95363b66c8 100644 (file)
@@ -1573,10 +1573,9 @@ test!(compile_then_delete {
     assert_that(p.cargo_process("run"), execs().with_status(0));
     assert_that(&p.bin("foo"), existing_file());
     if cfg!(windows) {
-        // HACKHACK: On windows unlinking immediately after running often fails, so sleep
-        use std::old_io::timer::sleep;
+        // On windows unlinking immediately after running often fails, so sleep
         use std::time::duration::Duration;
-        sleep(Duration::milliseconds(100));
+        ::sleep(Duration::milliseconds(100));
     }
     fs::remove_file(&p.bin("foo")).unwrap();
     assert_that(p.cargo("run"),
index df4aeff8131e52625796f55996fa41c2955d2e5a..cae0dcaddfd9968daa86e2d23b636ed82e67746f 100644 (file)
@@ -1,6 +1,5 @@
 use std::fs::{self, File};
 use std::io::prelude::*;
-use std::old_io::timer;
 use std::path::Path;
 use std::time::Duration;
 use git2;
@@ -56,7 +55,7 @@ fn add_submodule<'a>(repo: &'a git2::Repository, url: &str,
     let subrepo = s.open().unwrap();
     let mut origin = subrepo.find_remote("origin").unwrap();
     origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();
-    origin.fetch(&[], None, None).unwrap();
+    origin.fetch(&[], None).unwrap();
     origin.save().unwrap();
     subrepo.checkout_head(None).unwrap();
     s.add_finalize().unwrap();
@@ -163,7 +162,7 @@ test!(cargo_compile_git_dep_branch {
     let repo = git2::Repository::open(&git_project.root()).unwrap();
     let head = repo.head().unwrap().target().unwrap();
     let head = repo.find_commit(head).unwrap();
-    repo.branch("branchy", &head, true, None, None).unwrap();
+    repo.branch("branchy", &head, true).unwrap();
 
     let project = project
         .file("Cargo.toml", &format!(r#"
@@ -699,7 +698,7 @@ test!(update_with_shared_deps {
     add(&repo);
     commit(&repo);
 
-    timer::sleep(Duration::milliseconds(1000));
+    ::sleep(Duration::milliseconds(1000));
 
     // By default, not transitive updates
     println!("dep1 update");
@@ -891,7 +890,7 @@ test!(stale_cached_version {
     add(&repo);
     commit(&repo);
 
-    timer::sleep(Duration::milliseconds(1000));
+    ::sleep(Duration::milliseconds(1000));
 
     let rev = repo.revparse_single("HEAD").unwrap().id();
 
@@ -987,17 +986,17 @@ test!(dep_with_changed_submodule {
         let mut origin = subrepo.find_remote("origin").unwrap();
         origin.set_url(git_project3.url().to_string().as_slice()).unwrap();
         origin.add_fetch("refs/heads/*:refs/heads/*").unwrap();;
-        origin.fetch(&[], None, None).unwrap();
+        origin.fetch(&[], None).unwrap();
         origin.save().unwrap();
         let id = subrepo.refname_to_id("refs/remotes/origin/master").unwrap();
         let obj = subrepo.find_object(id, None).unwrap();
-        subrepo.reset(&obj, git2::ResetType::Hard, None, None, None).unwrap();
+        subrepo.reset(&obj, git2::ResetType::Hard, None).unwrap();
     }
     sub.add_to_index(true).unwrap();
     add(&repo);
     commit(&repo);
 
-    timer::sleep(Duration::milliseconds(1000));
+    ::sleep(Duration::milliseconds(1000));
     // Update the dependency and carry on!
     println!("update");
     assert_that(project.cargo("update").arg("-v"),
@@ -1095,7 +1094,7 @@ test!(git_build_cmd_freshness {
     }).unwrap();
     foo.root().move_into_the_past().unwrap();
 
-    timer::sleep(Duration::milliseconds(1000));
+    ::sleep(Duration::milliseconds(1000));
 
     assert_that(foo.cargo("build"),
                 execs().with_status(0)
index b2dfb2ab208e964d564919eaee11502d76f0718f..d4e19c306639e4841b8fd89e14ed7beee4a3a477 100644 (file)
@@ -1,6 +1,5 @@
 use std::fs::{self, File};
 use std::io::prelude::*;
-use std::old_io::timer;
 use std::time::Duration;
 
 use support::{project, execs, main_file};
@@ -353,7 +352,7 @@ test!(deep_dependencies_trigger_rebuild {
     //
     // We base recompilation off mtime, so sleep for at least a second to ensure
     // that this write will change the mtime.
-    timer::sleep(Duration::seconds(1));
+    ::sleep(Duration::seconds(1));
     File::create(&p.root().join("baz/src/baz.rs")).unwrap().write_all(br#"
         pub fn baz() { println!("hello!"); }
     "#).unwrap();
@@ -366,7 +365,7 @@ test!(deep_dependencies_trigger_rebuild {
                                             COMPILING, p.url())));
 
     // Make sure an update to bar doesn't trigger baz
-    timer::sleep(Duration::seconds(1));
+    ::sleep(Duration::seconds(1));
     File::create(&p.root().join("bar/src/bar.rs")).unwrap().write_all(br#"
         extern crate baz;
         pub fn bar() { println!("hello!"); baz::baz(); }
index 1940fe56747c18cf5f9d75e2975324452d339d95..e42e7f19e84ace702b1850928457c3529957fe30 100644 (file)
@@ -1,5 +1,5 @@
 use std::env;
-use std::old_path;
+use std::path::MAIN_SEPARATOR as SEP;
 
 use support::{project, execs};
 use support::{COMPILING, RUNNING};
@@ -38,7 +38,7 @@ test!(profile_overrides {
         -L dependency={dir}{sep}target{sep}debug \
         -L dependency={dir}{sep}target{sep}debug{sep}deps`
 ",
-running = RUNNING, compiling = COMPILING, sep = old_path::SEP,
+running = RUNNING, compiling = COMPILING, sep = SEP,
 dir = p.root().display(),
 url = p.url(),
 )));
@@ -109,7 +109,7 @@ test!(top_level_overrides_deps {
                     compiling = COMPILING,
                     dir = p.root().display(),
                     url = p.url(),
-                    sep = old_path::SEP,
+                    sep = SEP,
                     prefix = env::consts::DLL_PREFIX,
                     suffix = env::consts::DLL_SUFFIX).as_slice()));
 });
index 7311b4af299edbe3abfab3ff61efb5c765089013..15d61e9063720d66dfbb44b8d995040340cc56ba 100644 (file)
@@ -1,4 +1,4 @@
-use std::old_path;
+use std::path::MAIN_SEPARATOR as SEP;
 
 use support::{project, execs, path2url};
 use support::{COMPILING, RUNNING};
@@ -28,7 +28,7 @@ hello
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
     assert_that(&p.bin("foo"), existing_file());
 });
 
@@ -129,7 +129,7 @@ hello a.rs
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 
     assert_that(p.cargo("run").arg("--bin").arg("b"),
                 execs().with_status(0).with_stdout(format!("\
@@ -137,7 +137,7 @@ hello a.rs
 hello b.rs
 ",
         running = RUNNING,
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 });
 
 test!(run_example {
@@ -165,7 +165,7 @@ example
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 });
 
 test!(either_name_or_example {
@@ -217,7 +217,7 @@ hello main.rs
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 });
 
 test!(example_with_release_flag {
@@ -292,7 +292,7 @@ fast2
         running = RUNNING,
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 
     assert_that(p.cargo("run").arg("-v").arg("--example").arg("a"),
                 execs().with_status(0).with_stdout(format!("\
@@ -321,7 +321,7 @@ slow2
         running = RUNNING,
         dir = p.root().display(),
         url = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
 });
 
 test!(run_dylib_dep {
@@ -375,7 +375,7 @@ test!(release_works {
         compiling = COMPILING,
         running = RUNNING,
         dir = path2url(p.root()),
-        sep = old_path::SEP).as_slice()));
+        sep = SEP).as_slice()));
     assert_that(&p.release_bin("foo"), existing_file());
 });
 
index 559f672cb8fbd4d4925d7bf268d90d02932fbebd..a325165e81741d36de0b2b71dc95bb030be7ffea 100644 (file)
@@ -1,5 +1,6 @@
-use std::old_io::{MemWriter, IoResult, ChanReader, ChanWriter};
-use std::sync::mpsc::channel;
+use std::io::prelude::*;
+use std::io;
+use std::sync::{Arc, Mutex};
 use term::{Terminal, TerminfoTerminal, color};
 use hamcrest::{assert_that};
 
@@ -10,56 +11,60 @@ use support::{Tap, shell_writes};
 fn setup() {
 }
 
-fn pair() -> (ChanWriter, ChanReader) {
-    let (tx, rx) = channel();
-    (ChanWriter::new(tx), ChanReader::new(rx))
+struct Sink(Arc<Mutex<Vec<u8>>>);
+
+impl Write for Sink {
+    fn write(&mut self, data: &[u8]) -> io::Result<usize> {
+        Write::write(&mut *self.0.lock().unwrap(), data)
+    }
+    fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 
 test!(non_tty {
     let config = ShellConfig { color: true, verbose: true, tty: false };
-    let (tx, mut rx) = pair();
+    let a = Arc::new(Mutex::new(Vec::new()));
 
-    Shell::create(Box::new(tx), config).tap(|shell| {
+    Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| {
         shell.say("Hey Alex", color::RED).unwrap();
     });
 
-    let buf = rx.read_to_end().unwrap();
-    assert_that(buf.as_slice(), shell_writes("Hey Alex\n"));
+    let buf = a.lock().unwrap().clone();
+    assert_that(&buf[..], shell_writes("Hey Alex\n"));
 });
 
 test!(color_explicitly_disabled {
     let config = ShellConfig { color: false, verbose: true, tty: true };
-    let (tx, mut rx) = pair();
+    let a = Arc::new(Mutex::new(Vec::new()));
 
-    Shell::create(Box::new(tx), config).tap(|shell| {
+    Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| {
         shell.say("Hey Alex", color::RED).unwrap();
     });
-    let buf = rx.read_to_end().unwrap();
-    assert_that(buf.as_slice(), shell_writes("Hey Alex\n"));
+    let buf = a.lock().unwrap().clone();
+    assert_that(&buf[..], shell_writes("Hey Alex\n"));
 });
 
 test!(colored_shell {
-    let term = TerminfoTerminal::new(MemWriter::new());
+    let term = TerminfoTerminal::new(Vec::new());
     if term.is_none() { return }
 
     let config = ShellConfig { color: true, verbose: true, tty: true };
-    let (tx, mut rx) = pair();
+    let a = Arc::new(Mutex::new(Vec::new()));
 
-    Shell::create(Box::new(tx), config).tap(|shell| {
+    Shell::create(Box::new(Sink(a.clone())), config).tap(|shell| {
         shell.say("Hey Alex", color::RED).unwrap();
     });
-    let buf = rx.read_to_end().unwrap();
-    assert_that(buf.as_slice(),
+    let buf = a.lock().unwrap().clone();
+    assert_that(&buf[..],
                 shell_writes(colored_output("Hey Alex\n",
                                             color::RED).unwrap()));
 });
 
-fn colored_output<S: Str>(string: S, color: color::Color) -> IoResult<String> {
-    let mut term = TerminfoTerminal::new(MemWriter::new()).unwrap();
+fn colored_output(string: &str, color: color::Color) -> io::Result<String> {
+    let mut term = TerminfoTerminal::new(Vec::new()).unwrap();
     try!(term.reset());
     try!(term.fg(color));
-    try!(term.write_str(string.as_slice()));
+    try!(write!(&mut term, "{}", string));
     try!(term.reset());
     try!(term.flush());
-    Ok(String::from_utf8_lossy(term.get_ref().get_ref()).to_string())
+    Ok(String::from_utf8_lossy(term.get_ref()).to_string())
 }
index 356690d860cfadb88a836ead05b4904f2e16e51d..f5c790ba45842eee974dfb1ca4920d2098d38d55 100644 (file)
@@ -1,5 +1,5 @@
-#![feature(core, io, old_io, old_path)]
-#![feature(std_misc, io, path, fs, net, path_ext, fs_time, fs_walk)]
+#![feature(core, io, old_io)]
+#![feature(std_misc, io, fs, net, path_ext, fs_time, fs_walk)]
 
 extern crate "rustc-serialize" as serialize;
 extern crate cargo;
@@ -53,3 +53,8 @@ mod test_cargo_search;
 mod test_cargo_test;
 mod test_cargo_version;
 mod test_shell;
+
+#[allow(deprecated)]
+fn sleep(dur: std::time::Duration) {
+    std::old_io::timer::sleep(dur)
+}